/*
package com.travel.service.message;

import com.mongodb.client.result.DeleteResult;
import com.travel.common.ServerResponse;
import com.travel.dao.message.SingleMessageDAO;
import com.travel.pojo.message.SingleMessage;
import org.bson.types.ObjectId;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class SingleMessageServer {

    @Autowired
    SingleMessageDAO singleMessageDAO;

    */
/**
     * 单聊消息状态码更改
     * @param formid 发送者id
     * @param toid 接收者id
     * @param page 分页从第几个开始
     * @param rows 分页查询数量
     *//*

    public List<SingleMessage> querySingleMessage(Long formid, Long toid, Integer page, Integer rows){
        List<SingleMessage> list=this.singleMessageDAO.findListByFromAndTo(formid,toid, page, rows);
        //会查到page条消息，遍历将查到的消息的状态码改为已读
        for (SingleMessage message:list){
            if (message.getStatus().intValue()==1){
                this.singleMessageDAO.updateMessageState(message.getId(),2);
            }
        }
        return list;
    }

    */
/**
     *单人聊天消息删除
     * mongodb删除成功会返回结果DeletedCount=1
     * @param objectId 消息的唯一标识
     *//*

    public ServerResponse<String> deleteSingleMessage(ObjectId objectId){
        DeleteResult deleteResult=singleMessageDAO.deleteMessage(objectId);
        if (deleteResult.getDeletedCount()==1){
            return ServerResponse.createBySuccseeMessage("删除成功");
        }else {
            return ServerResponse.createByErrorMessage("删除失败");
        }
    }

}
*/
